/*	Usage:  request('login.php', {'password':pwd, 'username':un});
 * 
 */

function request(path, params, method) 
{
    method = method || "post";	// default post method
    
    var form = document.createElement("form");
    
    form.setAttribute("method", method);
    form.setAttribute("action", path);

     for(var key in params) {
        var hiddenField = document.createElement("input");
        hiddenField.setAttribute("type", "hidden");
        hiddenField.setAttribute("name", key);
        hiddenField.setAttribute("value", params[key]);

        form.appendChild(hiddenField);
    }

    document.body.appendChild(form); 
    form.submit();
}

function requestPage(path, page)
{
	var params = new Array()
	
	params['checkcode'] ="abc";
	params['page'] 		= page;
		
	request(path, params, 'post');
}


function vote(url, id, voteType)
{
	var oVote = $('#' + voteType + '_' + id);
	var voteValue = oVote.text();
	voteValue ++;
	
	oVote.text(voteValue);
	
	$.get(url + "/vote.php", {Action:"get", couponId:id, type:voteType}, function (data, textStatus)
	{
//		this;
//		alert(data);
//		alert(textStatus);
		
	});
}